package com.symria.taglib;

import java.io.IOException;
import javax.servlet.jsp.JspException;
import org.apache.struts2.views.jsp.StrutsBodyTagSupport;

import com.symria.framework.util.StringUtil;
import com.symria.role.util.Logger;
import com.symria.system.constants.ATTAdStatus;
import com.symria.system.constants.AppStatus;
import com.symria.system.constants.Status;


public class ParseBaseStatus extends StrutsBodyTagSupport {
	private static final Logger logger = Logger.getLogger(ParseBaseStatus.class);
    private String status;
    private String type;
    

	@Override
	public int doEndTag() throws JspException {
		return EVAL_PAGE;
	}
	@Override
	public int doStartTag() throws JspException {
	    try {
			pageContext.getOut().write(StatusName());
		} catch (IOException e) {
			logger.logError("adstatus tag error:"+e.getMessage());
		}
		return EVAL_BODY_BUFFERED;
	}
	private String StatusName(){
		String str = "";
	    if(StringUtil.equals("adcampaign",type )){
			return ATTAdStatus.valueToName(status);
		}else if(StringUtil.equals("appstatus", type)){
			return AppStatus.valueToName(status);
		}else if(StringUtil.equals("send", type)){
			return Status.Send.valueToHtmlName(status);
		}
		return str;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	
	
    

}
